
*{ Display organization, entities, topics, ideas, modes: 'all', 'one' }*

#{if _mode == 'all'}

	<div class="organizations">
    #{list items:_organizations, as:'organization'}
 
 *{ start testing member to organization relationship }*
 *{
<hr />
 <h3> ${_user.username}'s Organizations :</h3>
#{displayOrgs organizations:_user.organizationList, user:_user /}
<hr />
 <h3> ${organization.name}'s members : </h3>
#{displayMembers scope:organization, mode:'organization' /}
<hr />
}*
*{ testing organization members }*
 
		<div class="organization">
		#{if organization.privacy.equalsIgnoreCase("Private")  && !(organization.isMember(_user)) }
			<h3 class="name">${organization.name}</h3> 
		#{/if}
		#{else}
		%{organization.addMember(_user)}%
			<a href="@{Organizations.show(organization.id)}"> <h3 class="name">${organization.name}</h3> </a> 
		#{/else}
		%{organization.addMember(_user)}%
			${organization.privacy} is member (${organization.isMember(_user)})
			<div class="description">
				${organization.description}
			</div>
			<div class="enteties">
		        #{list items:organization.entites, as:'entity'}
				
				<div class="entity">
					#{if entity.organization.privacy.equalsIgnoreCase("Private")   && !(entity.organization.isMember(_user)) }
						<h3 class="name">${entity.name}</h3> 
					#{/if} #{else} <a href="@{Entities.show(entity.id)}"> <h3 class="name">${entity.name}</h3> </a>  #{/else}
					<div class="content">
						${entity.description}
					</div>
					
					<div class="topics">
					#{list items:entity.topics, as:'topic'}
				
						<div class="topic">
							#{if topic.organization.privacy.equalsIgnoreCase("Private") && !(topic.organization.isMember(_user)) }
								<h3 class="title">${topic.title}</h3>  
							#{/if} #{else} <a href="@{Topics.show(topic.id)}"> <h3 class="title">${topic.title}</h3> </a> #{/else}
							<div class="content">
								${topic.content}
							</div>
							topic's ideas:<br />
							
							#{displayIdeas ideas:topic.ideas, user:_user, mode:'normal' /}
	
						</div><br />
					#{/list}
					#{else} <br /> there are no topics in this entity #{/else}
					</div><br />
					entity's ideas:<br />
					
					#{displayIdeas ideas:entity.ideas, user:_user, mode:'normal' /}<br />
					
				</div><br />
			#{/list}
			#{else} <br /> there are no entities in this organization #{/else}
			</div> <br />
		</div> <br />
	#{/list}
	#{else} <br /> there are no organizations #{/else}
    </div>
    
    
#{/if}
